<?php
/**
 * Created by PhpStorm.
 * User: deng
 * Date: 2016/8/9
 * Time: 14:15
 */
class PinkMember extends AdminBase{

    function __construct(){
        parent::__construct();
        $this->{$this->op}();
    }

    function indexAction(){
        include_once template("admin_v2/user_report");
        exit();
    }

    function reportpageAction(){
        include_once template("admin_v2/user_report");
        exit();
    }

    function reportlistAction(){
        $this->req['start'] = isset($this->req['page']) ? (intval($this->req['page'])-1)*50 : 0;
        $this->req['length'] = 50;
        $this->fetchData(array_merge([
            'do'     => 'getInformList',
            'format' => 'json',
        ], $this->req));
    }

    function reporteditAction(){
        $this->req['id'] = isset($this->req['id']) ? intval($this->req['id']) : 0;
        $status = intval($this->req['status']);
		$this->req['muid'] = intval($this->req['muid']);
        $this->req['status'] = isset($this->req['status']) ? ( in_array($status, [0,1,2]) ? $status : 0 ) : 0;
        $this->req['dealResult'] = $this->req['status'];
        $this->fetchData(array_merge([
            'do'     => 'updateInform',
            'format' => 'json',
        ], $this->req));
    }

    function msgdetailAction(){
        $this->fetchData([
            'do'     => $this->do,
            'format' => 'json',
            'operate' => 'detail',
            'id' => $this->req['id']
        ]);
    }

    function addAction(){
        $this->fetchData(array_merge([
            'do'     => $this->do,
            'format' => 'json',
            'operate' => 'recommendEdit',
        ], $this->req));
    }

    function deleteAction(){
        $this->fetchData([
            'do'     => $this->do,
            'format' => 'json',
            'operate' => 'recommendDelete',
            'id' => $this->req['id']
        ]);
    }

    function flushdayAction(){
        $flush_day = $this->req['dates'] ? trim($this->req['dates']) : '';
        if (empty($flush_day))return $this->errorReturn('参数错误');
        $url = "http://tips.ffrj.net/tips/create?ymd=".$flush_day;
//     $url = "http://tips.ffrj.net/tips/create?ymd=20151106";
        $json = getHttpResponsePOST($url);
        $result = parseData($json);

        $res = 0;
        if (!empty($result['info']['url']) && !empty($result['info']['image_url'])) {
            $res = 1;
            $this->resultReturn();
        }
        $this->errorReturn('操作失败');
    }

}

new PinkMember;